home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / mail-tools / thor / unix / grab.oslonett < prev   
Text File  |  1996-02-26  |  3KB  |  89 lines

  1. #!/bin/sh
  2. ##########################################################################
  3. #     UQWK_SOUP grab script v0.95 for THOR.  Author: Kjell Irgens.       #
  4. # Should be safe to use, but I take *no* responsibilities for lost mail. #
  5. # grab -h for help.                                                      #
  6. # This version will export the active file, for non-standard setups.     #
  7. ##########################################################################
  8.  
  9. grab=soup                  # modify if the grab in THOR name is not "soup"
  10. wdir=soup                  # name of work directory (UN*X side)
  11.  
  12.        UQ_HOME_DIR=. UQ_DO_NEWS=1 UQ_SOUP_MODE=1 UQ_NRC_FILE=$HOME/.newsrc UQ_ACT_FILE="/local/news/active"
  13. export UQ_HOME_DIR   UQ_DO_NEWS   UQ_SOUP_MODE   UQ_NRC_FILE   UQ_ACT_FILE
  14.  
  15. repliesfile=$grab\.out
  16. grabfile=$grab`date +%H%M%S`.zip
  17.  
  18. mkdir 2>/dev/null $HOME/$wdir
  19. cd $HOME/$wdir
  20.  
  21. no_rz=false no_sz=false restore=false UQ_DO_MAIL=1
  22.  
  23. for i in $*
  24. do
  25.   case $i in
  26.   -r ) no_rz=true ;;
  27.   -s ) no_sz=true ;;
  28.   -n ) UQ_DO_NEWS=0 ; export UQ_DO_NEWS ;;
  29.   -m ) UQ_DO_MAIL=0 ; export UQ_DO_MAIL ;;
  30.   -u ) UQ_MAX_BLKS=0 ; export UQ_MAX_BLKS;;
  31.   -x ) if [ -r .mail_backup ]
  32.        then echo "Restoring mail..."
  33.        else echo "No mail to restore"
  34.        fi
  35.        cat 2>/dev/null .mail_backup >>$MAIL && rm 2>/dev/null .mail_backup
  36.        restore=true;;
  37.   -z ) if [ -r .newsrc_backup ]
  38.        then echo "Restoring news..."
  39.        else echo "No news to restore"
  40.        fi
  41.        mv 2>/dev/null .newsrc_backup $UQ_NRC_FILE
  42.        restore=true;;
  43.   *  )
  44.        echo "Usage: $0 [option] ..."
  45.        echo "[-r]  no rz";echo "[-s]  no sz";echo "[-n]  don't grab news"
  46.        echo "[-m]  don't grab mail";echo "[-u]  unlimited grab size"
  47.        echo "[-x]  restore mail";echo "[-z]  restore news"
  48.        echo "[-h]  this text"
  49.        exit 0 ;;
  50.   esac
  51. done
  52.  
  53. if [ $restore = true ]
  54. then exit 0
  55. fi
  56.  
  57. # backups never hurt anyone
  58. if [ $UQ_DO_MAIL = 1 ]
  59. then cp 2>/dev/null $MAIL .mail_backup
  60. fi
  61. if [ $UQ_DO_NEWS = 1 ]
  62. then cp 2>/dev/null $UQ_NRC_FILE .newsrc_backup
  63. fi
  64.  
  65.  
  66. if [ $no_rz = false ]
  67. then rz
  68. fi
  69.  
  70. if [ -r $repliesfile ]
  71. then unzip -U $repliesfile
  72. fi
  73.  
  74. if [ -r REPLIES ]
  75. then /local/bin/uqwk18.exe -RREPLIES
  76. else /local/bin/uqwk18.exe
  77. fi
  78.  
  79. rm 2>/dev/null $repliesfile
  80.  
  81. if [ -r AREAS ]
  82. then
  83.   zip -m $grabfile AREAS *.MSG
  84.   if [ $no_sz = false ]           # assumes you use zmodem, you could also
  85.   then                            # use: kermit -i -s $grabfile && ...
  86.     sz -br $grabfile && rm $grabfile
  87.   fi
  88. fi
  89.